﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;

using System.Windows.Forms;
using Utility;

namespace hpm
{
    class clsDangKyKham
    {
        DAL da = new DAL();
        public static DataTable dtbDangKyKham;
        SqlCommand slqcom;
        public static SqlDataAdapter sqlDataAdapter = null;
        SqlCommandBuilder bui = null;

        string _maBenhNhan, _maPhongKham, _ngayKham, _trangThai;


        public string MaBenhNhan
        { get; set; }

        public string MaPhongKham
        { get; set; }

        public string NgayKham
        { get; set; }

        public string TrangThai
        { get; set; }


        private DataRow buidDataRow(DataRow dr)
        {
          
            foreach (PropertyInfo prop in typeof(clsDangKyKham).GetProperties())
            {
                dr[prop.Name] = prop.GetValue(this, null);
            }
            return dr;
        }


        public bool LuuDangKy()
        {
            da.ketnoiServer();
            var sqlQuery = "select * from DangKyKham where 0 = 1";
            sqlDataAdapter = new SqlDataAdapter(sqlQuery, da.connString);
            bui = new SqlCommandBuilder(sqlDataAdapter);
            dtbDangKyKham = new DataTable();
            sqlDataAdapter.Fill(dtbDangKyKham);

            DataRow dr;
            dr = dtbDangKyKham.NewRow();
            this.buidDataRow(dr);
            dtbDangKyKham.Rows.Add(dr);
            sqlDataAdapter.Update(dtbDangKyKham);

            da.da_closeConnect();
        }
    }
}
